<template>
    <!-- 全省负氧离子站点 -->
    <div class="station">
        <stations-header></stations-header>
        <cesium-containers :newArr2="newArr2"></cesium-containers>
        <right-tool></right-tool>
        <common-bottom></common-bottom>
        <type-control></type-control>
    </div>
</template>
<script>
import CesiumContainers from '../cesium/CesiumContainers'
import StationsHeader from './components/StationsHeader'
import RightTool from './components/RightTool'
import CommonBottom from '../commons/CommonBottom'
import TypeControl from './components/TypeControl'

import axios from 'axios'
export default {
    name: 'AllStations',
    components: {
        CesiumContainers,
        StationsHeader,
        CommonBottom,
        RightTool,
        TypeControl
    },
    data(){
        return{
            timer:null,
            newArr2:[]
        }
    },
    watch:{
        allStations:{
            handler: function (newVal,oldVal){
                this.changeAllStation();
            },
            deep: true
        }
    },
    beforeMount(){
        
    },
    beforeDestroy(){
        if(this.timer){
          clearInterval(this.timer)
        }
    },
    mounted(){
        this.$comjs.onCenter(119.906064,29.573401,789000.0);
        this.getAllStationsData();
    },
    methods:{
        getAllStationsData(){  
            if(this.$comjs.isOnline){
                axios.get('/apis/api/FYLZ/GetProvinceStations').then(
                    this.getAllStationsDataInfo
                )
            }else{
                axios.get(this.$comjs.stations).then(
                    this.getAllStationsDataInfo
                )
            }
        },
        getAllStationsDataInfo(res){
            console.log(res)
            console.log(res.data)
            this.newArr2=res.data;
        }
    }
}
</script>
<style>
    .stationLeftContent{
        position: absolute;
        left: 0;
        color:white;
        top: 6.57vh;
        z-index: 2;
        width: 4.02rem;
        /* height: calc(100% - 1.32rem); 12.2vh*/
        height: 87.7vh;
        /* overflow: hidden; */
        background: rgba(7,23,42,0.49);
    }
    .stationLeftContent a{
        color: white;
        text-decoration :none;
    }
</style>


